package cn.jesin.ssmss01.controller;

import jakarta.servlet.http.HttpServletRequest;
import lombok.extern.slf4j.Slf4j;
import org.springframework.http.HttpStatus;
import org.springframework.http.ResponseEntity;
import org.springframework.web.bind.annotation.*;

/**
 * @author 谷汉斌
 * @description 这个类专门处理权限请求
 * @createTime 2024/8/12 下午2:42
 */
@Slf4j
@RestController
public class AuthenticationController {
    //以下是测试nginx设计的接口，引入spring security后，这就不需要了
    @RequestMapping("/verify")
    public ResponseEntity<String> verify(HttpServletRequest httpRequest) {

        //获取请求头
        String header = httpRequest.getHeader("Authorization");
        System.out.println("header: " + header);
        return ResponseEntity.status(HttpStatus.OK).body("success");
    }

    //处理前端请求
    @RequestMapping ("/success")
    public String success(){
        System.out.println("success");
        return "test  success by xfg";
    }
}